import type { IntentionData, State, UserInfo } from '/@/types';
import * as types from './mutationTypes';
import { ProjectConfig } from '../types/config';
import { StartDate } from '../hooks/useStartDate';

const mutations = {
  [types.SET_LOGIN_STATUS](state: State, loginStatus: number): void {
    state.loginStatus = loginStatus;
  },
  [types.SET_ACCESS_TOKEN](state: State, accessToken: string): void {
    state.accessToken = accessToken;
  },
  [types.SET_USER_INFO](state: State, userInfo: UserInfo): void {
    state.userInfo = userInfo;
  },
  [types.SET_CODE](state: State, code: string): void {
    state.code = code;
  },
  [types.SET_PROJECT_SETTING](state: State, projectSetting: ProjectConfig): void {
    state.projectSetting = projectSetting;
  },
  [types.SET_SCOPE_NUMBER](state: State, scopeNumber: number) {
    state.scopeNumber = scopeNumber;
  },
  [types.SET_START_DATE](state: State, startDate: StartDate) {
    state.startDate = startDate;
  },
  [types.SET_INTENTION](state: State, intention: IntentionData) {
    state.intention = intention;
  },
  [types.MY_INTENTION](state: State, myIntention: string) {
    state.myIntention = myIntention;
  },
};

export default mutations;
